import Vue from 'vue';
import VueRouter from 'vue-router';
import Layout from '../views/layout/Layout.vue';
import store from '@/vuex/index.js';

import otherRoutes from './other.js';

const menuRoutes = [
  // 首页
  {
    path: 'index',
    name: 'index',
    component(resolve) {
      require.ensure(['../views/home/Home.vue'], () => {
        resolve(require('../views/home/Home.vue'));
      });
    },
    meta: {
      name: 'Home',
      hideTabMenu: true,
      hideSideBar: true,
      isHome: true
    }
  },
  // 车场运营-月票管理-月票类型
  {
    path: 'month_ticket/manage',
    name: 'monthTicketManage',
    component(resolve) {
      require.ensure(['../views/month_ticket/manage.vue'], () => {
        resolve(require('../views/month_ticket/manage.vue'));
      });
    },
    meta: {
      name: 'monthTicketManage'
    }
  },
  // 车场运营-月票管理-月票凭证
  {
    path: 'month_ticket/certifi_rule',
    name: 'monthTicketCertifiRule',
    component(resolve) {
      require.ensure(['../views/month_ticket/certifi_rule.vue'], () => {
        resolve(require('../views/month_ticket/certifi_rule.vue'));
      });
    },
    meta: {
      name: 'monthTicketCertifiRule'
    }
  },
  // 车场运营-月票管理-月票凭证-凭证审核
  {
    path: 'month_ticket/certifi',
    name: 'monthTicketCertifi',
    component(resolve) {
      require.ensure(['../views/month_ticket/certifi.vue'], () => {
        resolve(require('../views/month_ticket/certifi.vue'));
      });
    },
    meta: {
      name: 'monthTicketCertifi'
    }
  },
  // 车场运营-月票管理-月票订单-月票订单
  {
    path: 'month_ticket/bill',
    name: 'monthTicketBill',
    component(resolve) {
      require.ensure(['../views/month_ticket/bill.vue'], () => {
        resolve(require('../views/month_ticket/bill.vue'));
      });
    },
    meta: {
      name: 'monthTicketBill'
    }
  },
  // 车场运营-月票管理-月票订单-月票收费明细
  {
    path: 'month_ticket/bill_detail',
    name: 'monthTicketBillDetail',
    component(resolve) {
      require.ensure(['../views/month_ticket/bill_detail.vue'], () => {
        resolve(require('../views/month_ticket/bill_detail.vue'));
      });
    },
    meta: {
      name: 'monthTicketBillDetail',
      titleExplain: '记录所有产生收费流水的车辆相关信息。正常出场或者异常放行出场并产生收费流程的车辆就会有收费流水产生'
    }
  },
  // 车场运营-月票管理-月票订单-储值扣费明细
  {
    path: 'report/store_value_charge_record',
    name: 'storeValueChargeRecord',
    component(resolve) {
      require.ensure(['../views/report/store_value_charge_record.vue'], () => {
        resolve(require('../views/report/store_value_charge_record.vue'));
      });
    },
    meta: {
      name: 'storeValueChargeRecord'
    }
  },
  // 车场运营-优惠管理-商户管理
  {
    path: 'coupon/trader',
    name: 'couponTrader',
    component(resolve) {
      require.ensure(['../views/coupon/Trader.vue'], () => {
        resolve(require('../views/coupon/Trader.vue'));
      });
    },
    meta: {
      name: 'couponTrader'
    }
  },
  // 车场运营-优惠管理-优惠券-优惠配置
  {
    path: 'coupon/manage',
    name: 'cManage',
    component(resolve) {
      require.ensure(['../views/coupon/c_manage.vue'], () => {
        resolve(require('../views/coupon/c_manage.vue'));
      });
    },
    meta: {
      name: 'cManage'
    }
  },
  // 车场运营-优惠管理-优惠券-售卖管理
  {
    path: 'coupon/sell',
    name: 'cSell',
    component(resolve) {
      require.ensure(['../views/coupon/c_sell.vue'], () => {
        resolve(require('../views/coupon/c_sell.vue'));
      });
    },
    meta: {
      name: 'cSell'
    }
  },
  // 车场运营-优惠管理-优惠券-发放记录
  {
    path: 'coupon/grant',
    name: 'cGrant',
    component(resolve) {
      require.ensure(['../views/coupon/grant.vue'], () => {
        resolve(require('../views/coupon/grant.vue'));
      });
    },
    meta: {
      name: 'cGrant'
    }
  },
  // 车场运营-优惠管理-优惠券-使用记录
  {
    path: 'coupon/use',
    name: 'cUse',
    component(resolve) {
      require.ensure(['../views/coupon/use.vue'], () => {
        resolve(require('../views/coupon/use.vue'));
      });
    },
    meta: {
      name: 'cUse'
    }
  },
  // 车场运营-活动优惠-活动优惠
  {
    path: 'coupon/compaign_coupon',
    name: 'compaignCoupon',
    component(resolve) {
      require.ensure(['../views/coupon/compaign_coupon.vue'], () => {
        resolve(require('../views/coupon/compaign_coupon.vue'));
      });
    },
    meta: {
      name: 'compaignCoupon'
    }
  },
  // 车场运营-活动优惠-优惠记录
  {
    path: 'coupon/compaign_coupon_water',
    name: 'compaignCouponWater',
    component(resolve) {
      require.ensure(['../views/coupon/compaign_coupon_water.vue'], () => {
        resolve(require('../views/coupon/compaign_coupon_water.vue'));
      });
    },
    meta: {
      name: 'compaignCouponWater'
    }
  },
  // 车场运营-车辆分类管理-指定车牌录入
  {
    path: 'park/emergency_carno',
    name: 'emergencyCarno',
    component(resolve) {
      require.ensure(['../views/park/emergency_carno.vue'], () => {
        resolve(require('../views/park/emergency_carno.vue'));
      });
    },
    meta: {
      name: 'emergencyCarno'
    }
  },
  // 车场运营-车辆分类管理-访客录入
  {
    path: 'park/park_visitorlist',
    name: 'parkVisitorlist',
    component(resolve) {
      require.ensure(['../views/park/park_visitorlist.vue'], () => {
        resolve(require('../views/park/park_visitorlist.vue'));
      });
    },
    meta: {
      name: 'parkVisitorlist'
    }
  },
  // 车场运营-车辆分类管理-黑名单录入
  {
    path: 'park/park_blacklist',
    name: 'parkBlacklist',
    component(resolve) {
      require.ensure(['../views/park/park_blacklist.vue'], () => {
        resolve(require('../views/park/park_blacklist.vue'));
      });
    },
    meta: {
      name: 'parkBlacklist'
    }
  },
  // 车场运营-车辆分类管理-白名单录入
  {
    path: 'park/park_redlist',
    name: 'parkRedlist',
    component(resolve) {
      require.ensure(['../views/park/park_redlist.vue'], () => {
        resolve(require('../views/park/park_redlist.vue'));
      });
    },
    meta: {
      name: 'parkRedlist'
    }
  },
  // 车场运营-车辆分类管理-特殊车辆类型
  {
    path: 'park/specialCarTypeConfig',
    name: 'specialCarTypeConfig',
    component(resolve) {
      require.ensure(['../views/operation/special_car_type_config.vue'], () => {
        resolve(require('../views/operation/special_car_type_config.vue'));
      });
    },
    meta: {
      name: 'specialCarTypeConfig'
    }
  },
  // 车场运营-增值服务-开通服务
  {
    path: 'other_service/open_index',
    name: 'otherServiceOpenIndex',
    component(resolve) {
      require.ensure(['../views/other_service/open_index.vue'], () => {
        resolve(require('../views/other_service/open_index.vue'));
      });
    },
    meta: {
      name: 'otherServiceOpenIndex'
    }
  },
  // 增值服务-开通服务-电子发票-电子发票报表
  {
    path: 'user_invoice/invoice_form',
    name: 'invoiceForm',
    component(resolve) {
      require.ensure(['../views/user_invoice/invoice_form.vue'], () => {
        resolve(require('../views/user_invoice/invoice_form.vue'));
      });
    },
    meta: {
      name: 'invoiceForm'
    }
  },
  // 车场运营-增值服务-中央值守
  {
    path: 'authz/cenduty_seat_manage',
    name: 'cendutySeatManage',
    component(resolve) {
      require.ensure(['../views/platform_manage/cenduty_seat_manage.vue'], () => {
        resolve(require('../views/platform_manage/cenduty_seat_manage.vue'));
      });
    },
    meta: {
      name: 'cendutySeatManage'
    }
  },
  // 车场运营-增值服务-车场积分配置
  {
    path: 'score/config',
    name: 'scoreConfig',
    component(resolve) {
      require.ensure(['../views/score/config.vue'], () => {
        resolve(require('../views/score/config.vue'));
      });
    },
    meta: {
      name: 'scoreConfig'
    }
  },
  // 车场运营-增值服务-车场积分流水
  {
    path: 'score/record_water',
    name: 'scoreRecordWater',
    component(resolve) {
      require.ensure(['../views/score/record_water.vue'], () => {
        resolve(require('../views/score/record_water.vue'));
      });
    },
    meta: {
      name: 'scoreRecordWater'
    }
  },
  // 车场运营-增值服务-车场积分报表
  {
    path: 'score/report',
    name: 'scoreReport',
    component(resolve) {
      require.ensure(['../views/score/report.vue'], () => {
        resolve(require('../views/score/report.vue'));
      });
    },
    meta: {
      name: 'scoreReport'
    }
  },
  //  车场运营-增值服务-移动盘点-POS机管理员
  {
    path: 'mobile/user',
    name: 'mobileUser',
    component(resolve) {
      require.ensure(['../views/mobile/mobile_user.vue'], () => {
        resolve(require('../views/mobile/mobile_user.vue'));
      });
    },
    meta: {
      name: 'mobileUser'
    }
  },
  // 车场运营-增值服务-移动盘点-车场盘点记录
  {
    path: 'mobile/parking_check_detail',
    name: 'parkingCheckDetail',
    component(resolve) {
      require.ensure(['../views/mobile/parking_check_detail.vue'], () => {
        resolve(require('../views/mobile/parking_check_detail.vue'));
      });
    },
    meta: {
      name: 'parkingCheckDetail'
    }
  },
  // 车场运营-增值服务-移动盘点-盘点操作记录
  {
    path: 'mobile/parking_check',
    name: 'parkingCheck',
    component(resolve) {
      require.ensure(['../views/mobile/parking_check.vue'], () => {
        resolve(require('../views/mobile/parking_check.vue'));
      });
    },
    meta: {
      name: 'parkingCheck'
    }
  },
  // 车场运营-增值服务-移动盘点-事件记录
  {
    path: 'mobile/event',
    name: 'mobileEvent',
    component(resolve) {
      require.ensure(['../views/mobile/event.vue'], () => {
        resolve(require('../views/mobile/event.vue'));
      });
    },
    meta: {
      name: 'mobileEvent'
    }
  },
  // 车场运营-增值服务-移动盘点-违规记录
  {
    path: 'mobile/parking_violate',
    name: 'parkingViolate',
    component(resolve) {
      require.ensure(['../views/mobile/parking_violate.vue'], () => {
        resolve(require('../views/mobile/parking_violate.vue'));
      });
    },
    meta: {
      name: 'parkingViolate'
    }
  },
  // 车场运营-增值服务-共享车辆-共享车位信息管理
  {
    path: 'share/manage',
    name: 'shareManage',
    component(resolve) {
      require.ensure(['../views/share/manage.vue'], () => {
        resolve(require('../views/share/manage.vue'));
      });
    },
    meta: {
      name: 'shareManage'
    }
  },
  // 车场运营-增值服务-共享车辆-共享车位订单流水
  {
    path: 'share/water',
    name: 'shareWater',
    component(resolve) {
      require.ensure(['../views/share/water.vue'], () => {
        resolve(require('../views/share/water.vue'));
      });
    },
    meta: {
      name: 'shareWater'
    }
  },
  // 车场运营-增值服务-预订车辆-预订参数设置
  {
    path: 'booking/booking_rule',
    name: 'bookingRule',
    component(resolve) {
      require.ensure(['../views/booking/booking_rule.vue'], () => {
        resolve(require('../views/booking/booking_rule.vue'));
      });
    },
    meta: {
      name: 'bookingRule'
    }
  },
  // 车场运营-增值服务-预订车辆-预订订单流水
  {
    path: 'booking/booking_record',
    name: 'bookingRecord',
    component(resolve) {
      require.ensure(['../views/booking/booking_record.vue'], () => {
        resolve(require('../views/booking/booking_record.vue'));
      });
    },
    meta: {
      name: 'bookingRecord'
    }
  },
  // 车场运营-增值服务-车位预订-预订报表
  {
    path: 'booking/booking_form',
    name: 'bookingForm',
    component(resolve) {
      require.ensure(['../views/booking/booking_form.vue'], () => {
        resolve(require('../views/booking/booking_form.vue'));
      });
    },
    meta: {
      name: 'bookingForm'
    }
  },
  // 车场运营-车场管理-车场人员管理-收费员
  {
    path: 'authz/miniprogram_user_manage',
    name: 'miniprogramUserManage',
    component(resolve) {
      require.ensure(['../views/platform_manage/miniprogram_user_manage.vue'], () => {
        resolve(require('../views/platform_manage/miniprogram_user_manage.vue'));
      });
    },
    meta: {
      name: 'miniprogramUserManage'
    }
  },
  // 车场运营-车场管理-车场配置
  {
    path: 'park/config/manage_index',
    name: 'manageIndex',
    component(resolve) {
      require.ensure(['../views/ParkingLot/parkingLotSetting/index.vue'], () => {
        resolve(require('../views/ParkingLot/parkingLotSetting/index.vue'));
      });
    },
    meta: {
      name: 'manageIndex'
    }
  },

  {
    //车场运营-车场管理-车场配置-语音配置(编辑)
    path: 'park/config/interCome',
    name: 'editInterCome',
    component(resolve) {
      require.ensure(['../views/ParkingLot/InterCome/interCome.vue'], () => {
        resolve(require('../views/ParkingLot/InterCome/interCome.vue'));
      });
    },
    meta: {
      name: 'editInterCome',
      isNewTab: true
    }
  },

  // 信息查询-车辆查询-在场车辆
  {
    path: 'operation/present',
    name: 'present',
    component(resolve) {
      require.ensure(['../views/operation/present.vue'], () => {
        resolve(require('../views/operation/present.vue'));
      });
    },
    meta: {
      name: 'present',
      titleExplain: '车辆入场时记录信息和车辆在场内产生的信息' //表头说明
    }
  },
  // 信息查询-车辆查询-收费明细
  {
    path: 'operation/charge_water',
    name: 'chargeWater',
    component(resolve) {
      require.ensure(['../views/operation/charge_water.vue'], () => {
        resolve(require('../views/operation/charge_water.vue'));
      });
    },
    meta: {
      name: 'chargeWater'
    }
  },
  // 信息查询-车辆查询-欠费记录
  {
    path: 'operation/park_arrear_car',
    name: 'parkArrearCar',
    component(resolve) {
      require.ensure(['../views/operation/park_arrear_car.vue'], () => {
        resolve(require('../views/operation/park_arrear_car.vue'));
      });
    },
    meta: {
      name: 'parkArrearCar',
      titleExplain: '该功能模块记录所有欠费车辆的相关信息，欠费车辆指的是在常开模式中，出场后有欠费尚未交清的车辆'
    }
  },
  // 信息查询-告警信息-车辆告警记录
  {
    path: 'park/emergency_record',
    name: 'emergencyRecord',
    component(resolve) {
      require.ensure(['../views/park/emergency_record.vue'], () => {
        resolve(require('../views/park/emergency_record.vue'));
      });
    },
    meta: {
      name: 'emergencyRecord'
    }
  },
  //信息查询-车辆查询-进出场记录
  {
    path: 'operation/park_inout_record',
    name: 'parkInoutRecord',
    component(resolve) {
      require.ensure(['../views/operation/park_inout_record.vue'], () => {
        resolve(require('../views/operation/park_inout_record.vue'));
      });
    },
    meta: {
      name: 'parkInoutRecord',
      titleExplain: '进出场记录中记录的信息条目为所有车辆的离场记录以及未出场的车辆（不包括非系统开闸、异常拍照）'
    }
  },
  // 信息查询-告警信息-离线告警日志-通道离线告警
  {
    path: 'park/offline_emergency_record',
    name: 'offlineEmergencyRecord',
    component(resolve) {
      require.ensure(['../views/park/offline_emergency_record.vue'], () => {
        resolve(require('../views/park/offline_emergency_record.vue'));
      });
    },
    meta: {
      name: 'offlineEmergencyRecord'
    }
  },
  // 信息查询-告警信息-离线告警日志-服务器离线告警
  {
    path: 'park/service_emergency_record',
    name: 'serviceEmergencyRecord',
    component(resolve) {
      require.ensure(['../views/park/service_emergency_record.vue'], () => {
        resolve(require('../views/park/service_emergency_record.vue'));
      });
    },
    meta: {
      name: 'offlineEmergencyRecord'
    }
  },
  // 信息查询-告警信息-离线告警日志-摄像枪离线告警
  {
    path: 'park/camera_emergency_record',
    name: 'cameraEmergencyRecord',
    component(resolve) {
      require.ensure(['../views/park/camera_emergency_record.vue'], () => {
        resolve(require('../views/park/camera_emergency_record.vue'));
      });
    },
    meta: {
      name: 'offlineEmergencyRecord'
    }
  },
  // 信息查询-系统日志-系统操作日志
  {
    path: 'authz/plog',
    name: 'authzPlog',
    component(resolve) {
      require.ensure(['../views/platform_manage/plog.vue'], () => {
        resolve(require('../views/platform_manage/plog.vue'));
      });
    },
    meta: {
      name: 'authzPlog'
    }
  },
  // 信息查询-技术支持-异常拍照
  {
    path: 'operation/park_abnormal_pic_car',
    name: 'parkAbnormalPicCar',
    component(resolve) {
      require.ensure(['../views/operation/park_abnormal_pic_car.vue'], () => {
        resolve(require('../views/operation/park_abnormal_pic_car.vue'));
      });
    },
    meta: {
      name: 'parkAbnormalPicCar',
      titleExplain:
        '异常拍照指所有车辆进场或出场时，一体机产生识别拍照动作但未做放行操作，此时再次触发拍照动作，则前一次拍照记录被记为一条异常拍照流水，包含车牌照片及车辆信息'
    }
  },
  // 信息查询-技术支持-异常进场
  {
    path: 'operation/abnormal_in_car',
    name: 'abnormalInCar',
    component(resolve) {
      require.ensure(['../views/operation/abnormal_in_car.vue'], () => {
        resolve(require('../views/operation/abnormal_in_car.vue'));
      });
    },
    meta: {
      name: 'abnormalInCar',
      titleExplain:
        '1.车辆进场时，系统检测到该车辆已有在场车辆记录，则把前一次的进场记录归为异常进场记录；2.车辆被“盘点离场”后，该车辆的进场记录归为是异常进场记录。'
    }
  },
  // 信息查询-技术支持-非系统开闸
  {
    path: 'operation/park_abnormal_open_gate_car',
    name: 'parkAbnormalOpenGateCar',
    component(resolve) {
      require.ensure(['../views/operation/park_abnormal_open_gate_car.vue'], () => {
        resolve(require('../views/operation/park_abnormal_open_gate_car.vue'));
      });
    },
    meta: {
      name: 'parkAbnormalOpenGateCar',
      titleExplain: '记录了特殊情况下需遥控强制开闸和可疑跟车开闸'
    }
  },
  // 信息查询-技术支持-校正流水
  {
    path: 'operation/adjust_car_record',
    name: 'adjustCarRecord',
    component(resolve) {
      require.ensure(['../views/operation/adjust_car_record.vue'], () => {
        resolve(require('../views/operation/adjust_car_record.vue'));
      });
    },
    meta: {
      name: 'adjustCarRecord',
      titleExplain:
        '校正流水功能模块记录所有产生校正流水的车辆相关信息。校正流水信息的产生来源为中央监控、岗亭端、中央收费等渠道。可供管理员随时查询车辆的校正相关信息。发生了校正操作的车辆就会有校正流水产生'
    }
  },
  // 信息查询-技术支持-拍照流水
  {
    path: 'operation/photo_record',
    name: 'photoRecord',
    component(resolve) {
      require.ensure(['../views/operation/photo_record.vue'], () => {
        resolve(require('../views/operation/photo_record.vue'));
      });
    },
    meta: {
      name: 'photoRecord'
    }
  },
  // 账号管理-用户
  {
    path: 'authz/user',
    name: 'authzUser',
    component(resolve) {
      require.ensure(['../views/platform_manage/User.vue'], () => {
        resolve(require('../views/platform_manage/User.vue'));
      });
    },
    meta: {
      name: 'authzUser'
    }
  },
  // 账号管理-角色
  {
    path: 'authz/role',
    name: 'authzRole',
    component(resolve) {
      require.ensure(['../views/platform_manage/Role.vue'], () => {
        resolve(require('../views/platform_manage/Role.vue'));
      });
    },
    meta: {
      name: 'authzRole'
    }
  },
  // 账号管理-车场分组
  {
    path: 'authz/parking_group',
    name: 'authzParkingGroup',
    component(resolve) {
      require.ensure(['../views/platform_manage/ParkingGroup.vue'], () => {
        resolve(require('../views/platform_manage/ParkingGroup.vue'));
      });
    },
    meta: {
      name: 'authzParkingGroup'
    }
  },
  // 统计分析-运营分析
  {
    path: 'stat/parking',
    name: 'statParking',
    component(resolve) {
      require.ensure(['../views/statistic/parking.vue'], () => {
        resolve(require('../views/statistic/parking.vue'));
      });
    },
    meta: {
      name: 'statParking'
    }
  },
  // 统计分析-利润报表(开发中...)
  {
    path: 'stat/operatingFinanceReport',
    name: 'operatingFinanceReport',
    component(resolve) {
      require.ensure(['../views/statistic/operatingFinanceReport.vue'], () => {
        resolve(require('../views/statistic/operatingFinanceReport.vue'));
      });
    },
    meta: {
      name: 'operatingFinanceReport'
    }
  },
  // 统计分析-商户分析
  {
    path: 'stat/trader',
    name: 'statTrader',
    component(resolve) {
      require.ensure(['../views/statistic/trader.vue'], () => {
        resolve(require('../views/statistic/trader.vue'));
      });
    },
    meta: {
      name: 'statTrader'
    }
  },
  // 统计分析-财务分析
  {
    path: 'report/incomeSummaryReport',
    name: 'incomeSummaryReport',
    component(resolve) {
      require.ensure(['../views/report/incomeSummaryReport.vue'], () => {
        resolve(require('../views/report/incomeSummaryReport.vue'));
      });
    },
    meta: {
      name: 'incomeSummaryReport'
    }
  },
  // 统计分析-报表
  {
    path: 'report/index',
    name: 'reportIndex',
    component(resolve) {
      require.ensure(['../views/report/report_index.vue'], () => {
        resolve(require('../views/report/report_index.vue'));
      });
    },
    meta: {
      name: 'reportIndex',
      hideTabMenu: true
    }
  },
  // 统计分析-微信报表推送
  {
    path: 'report/data_push',
    name: 'reportDataPush',
    component(resolve) {
      require.ensure(['../views/report/data_push.vue'], () => {
        resolve(require('../views/report/data_push.vue'));
      });
    },
    meta: {
      name: 'reportDataPush'
    }
  },

  // 统计报表-临停收费报表
  {
    path: 'report/tmp_charge',
    name: 'tmpCharge',
    component(resolve) {
      require.ensure(['../views/report/R_tmp_charge.vue'], () => {
        resolve(require('../views/report/R_tmp_charge.vue'));
      });
    },
    meta: {
      name: 'tmpCharge',
      isReport: true, //是否是报表页
      isNewTab: true
    }
  },
  // 统计报表-月票收入汇总
  {
    path: 'park_vip/daily_report',
    name: 'parkVipDailyReport',
    component(resolve) {
      require.ensure(['../views/park_vip/daily_report.vue'], () => {
        resolve(require('../views/park_vip/daily_report.vue'));
      });
    },
    meta: {
      name: 'parkVipDailyReport',
      isReport: true, //是否是报表页
      isNewTab: true
    }
  },
  // 统计报表-VIP统计报表
  {
    path: 'report/vip_charge',
    name: 'vipCharge',
    component(resolve) {
      require.ensure(['../views/report/R_vip_charge.vue'], () => {
        resolve(require('../views/report/R_vip_charge.vue'));
      });
    },
    meta: {
      name: 'vipCharge',
      isReport: true, //是否是报表页
      isNewTab: true
    }
  },
  // 统计报表-进出场报表
  {
    path: 'report/parking_record',
    name: 'parkingRecord',
    component(resolve) {
      require.ensure(['../views/report/R_parking_record.vue'], () => {
        resolve(require('../views/report/R_parking_record.vue'));
      });
    },
    meta: {
      name: 'parkingRecord',
      isReport: true, //是否是报表页
      isNewTab: true
    }
  },
  // 统计报表-通道进出报表
  {
    path: 'report/channel',
    name: 'reportChannel',
    component(resolve) {
      require.ensure(['../views/report/channel_inout_report.vue'], () => {
        resolve(require('../views/report/channel_inout_report.vue'));
      });
    },
    meta: {
      name: 'reportChannel',
      isReport: true, //是否是报表页
      isNewTab: true
    }
  },
  // 统计报表-通道收费报表
  {
    path: 'report/channel_charge',
    name: 'reportChannelCharge',
    component(resolve) {
      require.ensure(['../views/report/channel_charge_report.vue'], () => {
        resolve(require('../views/report/channel_charge_report.vue'));
      });
    },
    meta: {
      name: 'reportChannelCharge',
      isReport: true, //是否是报表页
      isNewTab: true
    }
  },
  // 统计报表-通道收费报表new
  {
    path: 'report/channel_charge_new',
    name: 'reportChannelChargeNew',
    component(resolve) {
      require.ensure(['../views/report/channel_charge_report_new.vue'], () => {
        resolve(require('../views/report/channel_charge_report_new.vue'));
      });
    },
    meta: {
      name: 'reportChannelChargeNew',
      isReport: true, //是否是报表页
      isNewTab: true
    }
  },
  // 统计报表-交接班报表
  {
    path: 'report/shift',
    name: 'reportShift',
    component(resolve) {
      require.ensure(['../views/report/R_shift.vue'], () => {
        resolve(require('../views/report/R_shift.vue'));
      });
    },
    meta: {
      name: 'reportShift',
      isReport: true, //是否是报表页
      isNewTab: true
    }
  },
  // 统计报表-交接班报表(新)
  {
    path: 'report/shift_new',
    name: 'reportShiftNew',
    component(resolve) {
      require.ensure(['../views/report/R_shift_new.vue'], () => {
        resolve(require('../views/report/R_shift_new.vue'));
      });
    },
    meta: {
      name: 'reportShiftNew',
      isReport: true, //是否是报表页
      isNewTab: true
    }
  },
  // 统计报表-收费员报表
  {
    path: 'report/tollCollector',
    name: 'tollCollector',
    component(resolve) {
      require.ensure(['../views/report/toll_collector_report.vue'], () => {
        resolve(require('../views/report/toll_collector_report.vue'));
      });
    },
    meta: {
      name: 'tollCollector',
      isReport: true, //是否是报表页
      isNewTab: true
    }
  },
  // 统计报表-支付统计报表
  {
    path: 'report/payment',
    name: 'reportPayment',
    component(resolve) {
      require.ensure(['../views/report/payment_report.vue'], () => {
        resolve(require('../views/report/payment_report.vue'));
      });
    },
    meta: {
      name: 'reportPayment',
      isReport: true, //是否是报表页
      isNewTab: true
    }
  },
  // 统计报表-支付方式明细报表
  {
    path: 'report/pay_mode',
    name: 'payMode',
    component(resolve) {
      require.ensure(['../views/report/pay_mode.vue'], () => {
        resolve(require('../views/report/pay_mode.vue'));
      });
    },
    meta: {
      name: 'payMode',
      isReport: true, //是否是报表页
      isNewTab: true
    }
  },
  // 统计报表-车场积分报表
  // {
  //   path: 'score/report',
  //   name: 'scoreReport',
  //   component(resolve) {
  //     require.ensure(['../views/score/report.vue'], () => {
  //       resolve(require('../views/score/report.vue'));
  //     });
  //   },
  //   meta: {
  //     name: 'scoreReport',
  //     isReport: true, //是否是报表页
  //     isNewTab: true
  //   }
  // },
  // 统计报表-预订报表
  // {
  //   path: 'booking/booking_form',
  //   name: 'bookingForm',
  //   component(resolve) {
  //     require.ensure(['../views/booking/booking_form.vue'], () => {
  //       resolve(require('../views/booking/booking_form.vue'));
  //     });
  //   },
  //   meta: {
  //     name: 'bookingForm',
  //     isReport: true, //是否是报表页
  //     isNewTab: true
  //   }
  // },
  // 统计报表-商家报表
  {
    path: 'report/trader',
    name: 'reportTrader',
    component(resolve) {
      require.ensure(['../views/report/Trader.vue'], () => {
        resolve(require('../views/report/Trader.vue'));
      });
    },
    meta: {
      name: 'reportTrader',
      isNewTab: true,
      isReport: true //是否是报表页
    }
  },
  // 统计报表-月票分月收入汇总
  {
    path: 'park_vip/month_income',
    name: 'parkVipMonthIncome',
    component(resolve) {
      require.ensure(['../views/park_vip/month_income.vue'], () => {
        resolve(require('../views/park_vip/month_income.vue'));
      });
    },
    meta: {
      name: 'parkVipMonthIncome',
      isReport: true, //是否是报表页
      isNewTab: true
    }
  },
  // 统计报表-移动管理报表
  // {
  //   path: 'mobile/report',
  //   name: 'mobileReport',
  //   component(resolve) {
  //     require.ensure(['../views/mobile/mobile_report.vue'], () => {
  //       resolve(require('../views/mobile/mobile_report.vue'));
  //     });
  //   },
  //   meta: {
  //     name: 'mobileReport',
  //     isReport: true, //是否是报表页
  //     isNewTab: true
  //   }
  // },
  {
    //统计报表-月票财务报表
    path: '/report/monthTicket_finance_report',
    name: 'monthTicket_finance_report',
    component(resolve) {
      require.ensure(['../views/report/month_ticket_finance_report.vue'], () => {
        resolve(require('../views/report/month_ticket_finance_report.vue'));
      });
    },
    meta: {
      name: 'monthTicket_finance_report',
      isReport: true, //是否是报表页
      isNewTab: true
    }
  },
  {
    path: '/Rear_entrance',
    name: 'Rear_entrance',
    component(resolve) {
      require.ensure(['../views/Rear_entrance.vue'], () => {
        resolve(require('../views/Rear_entrance.vue'));
      });
    },
    meta: {
      name: 'Rear_entrance',
      isNewTab: true,
      isReport: true //是否是报表页
    }
  },
  {
    // 统计报表-临停收费报表（新）
    path: '/report/tmp_charge_new',
    name: 'report_tmp_charge_new',
    component(resolve) {
      require.ensure(['../views/report/R_tmp_charge_new.vue'], () => {
        resolve(require('../views/report/R_tmp_charge_new.vue'));
      });
    },
    meta: {
      name: 'report_tmp_charge_new',
      isReport: true, //是否是报表页
      isNewTab: true
    }
  },
  {
    //统计报表-月票收费报表
    path: '/report/month_ticket_bill_payment_report',
    name: 'month_ticket_bill_payment_report',
    component(resolve) {
      require.ensure(['../views/report/month_ticket_sum_report.vue'], () => {
        resolve(require('../views/report/month_ticket_sum_report.vue'));
      });
    },
    meta: {
      name: 'month_ticket_bill_payment_report',
      isNewTab: true,
      isReport: true //是否是报表页
    }
  },
  {
    // 报表管理-城市运营券使用记录
    path: '/cityCoupon/useRecord',
    name: 'city_coupon_use_record',
    component(resolve) {
      require.ensure(['../views/cityCoupon/useRecord.vue'], () => {
        resolve(require('../views/cityCoupon/useRecord.vue'));
      });
    },
    meta: {
      name: 'city_coupon_use_record',
      isReport: true, //是否是报表页
      isNewTab: true
    }
  },
  ,
  {
    // 统计报表-临停支付统计报表
    path: '/report/payment_new',
    name: 'report_payment_new',
    component(resolve) {
      require.ensure(['../views/report/payment_report_new.vue'], () => {
        resolve(require('../views/report/payment_report_new.vue'));
      });
    },
    meta: {
      name: 'report_payment_new',
      isReport: true, //是否是报表页
      isNewTab: true
    }
  }
].concat(otherRoutes);

const routes = [
  {
    path: '/',
    name: 'login#',
    component(resolve) {
      require.ensure(['../views/Login.vue'], () => {
        resolve(require('../views/Login.vue'));
      });
    }
  },
  {
    path: '/login',
    name: 'login',
    component(resolve) {
      require.ensure(['../views/Login.vue'], () => {
        resolve(require('../views/Login.vue'));
      });
    }
  },
  // 新UI路由
  {
    path: '/',
    component: Layout,
    children: menuRoutes
  }
];

Vue.use(VueRouter);

const router = new VueRouter({
  routes
});

// vue-router报错解决方案
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

router.beforeEach((to, from, next) => {
  if (
    store.getters.getIsNeedAddParkinglotFirst &&
    to.name !== 'addParkingLot' &&
    window.localStorage.getItem('isLogout') === '2'
  ) {
    next({
      name: 'addParkingLot',
      query: {
        isNeedAddParkinglotFirst: true
      }
    });
    return;
  } else {
    next();
  }
});
export default router;
